package gamecenter.gc.service.Imp;

import gamecenter.gc.bean.User;
import gamecenter.gc.mapper.User_Mapper;
import gamecenter.gc.service.User_Service;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class User_Service_Imp implements User_Service {
    @Resource
    private User_Mapper user_Mapper;

    @Override
    public boolean register(String name, String password) {
        User user = user_Mapper.get_Cer_User_From_Name(name);
        if (user != null) {
            return false;
        }
        user_Mapper.register(name, password);
        return true;
    }

    @Override
    public User get_Cer_User_From_Name(String name) {
        return user_Mapper.get_Cer_User_From_Name(name);
    }

    @Override
    public boolean check_User(String name, String password) {
        User user = user_Mapper.check_User(name, password);
        return user != null;
    }

    @Override
    public void modify_User_Password(String name, String password) {
        user_Mapper.modify_User_Password(name, password);
    }

    @Override
    public void modify_User_Age(String name, int age) {
        user_Mapper.modify_User_Age(name, age);
    }

    @Override
    public void modify_User_Photo(String name, String photo) {
        user_Mapper.modify_User_Photo(name, photo);
    }

    @Override
    public void user_Recharge(String name, int money) {
        user_Mapper.user_Recharge(name, money);
    }

    @Override
    public void user_Purchase(String name, int money) {
        user_Mapper.user_Purchase(name, money);
    }
}
